import groovy.text.XmlTemplateEngine

def binding = [name: 'Jacke', id: 1, subject: "Groovy"]
def engine = new XmlTemplateEngine()

def text = '''
    <document xmlns:gsp='http://groovy.codehaus.org/2005/gsp'>
        <Student>
            <name>${name}</name>
            <id>${id}</id>
            <subject>${subject}</subject>
        </Student>
    </document>
'''

def template = engine.createTemplate(text).make(binding)
println template